<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>房间列表</title>
    <link rel="stylesheet" href="/static/common/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/style.css">
    <script src="/static/common/layui/layui.js"></script>
    <script src="/static/common/jquery-3.3.1.min.js"></script>
    <script src="/static/common/vue.min.js"></script>
    <style>
        #container {
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        #search1, #search2, #search3 {
            display: flex;
            align-items: center;
            width: 380px;
        }

        .search-label {
            white-space: nowrap;
            margin-right: 10px;
            flex-shrink: 0;
        }

        .search-input {
            flex: 1;
        }
    </style>

</head>
<body>
<div id="app">
    <!--顶栏-->
    <%@include file="/views/top.jsp"%>

    <div class="main">
        <!--左栏-->
        <div class="left">
            <ul class="cl" >
                <!--顶级分类-->
                <li v-for="vo,index in menu" :class="{hidden:vo.hidden}">
                    <a href="javascript:;"  :class="{active:vo.active}"  @click="onActive(index)">
                        <i class="layui-icon" v-html="vo.icon"></i>
                        <span v-text="vo.name"></span>
                        <i class="layui-icon arrow" v-show="vo.url.length==0">&#xe61a;</i> <i v-show="vo.active" class="layui-icon active">&#xe623;</i>
                    </a>
                    <!--子级分类-->
                    <div v-for="vo2,index2 in vo.list">
                        <a href="javascript:;" :class="{active:vo2.active}" @click="onActive(index,index2)" v-text="vo2.name"></a>
                        <i v-show="vo2.active" class="layui-icon active">&#xe623;</i>
                    </div>
                </li>
            </ul>
        </div>
        <!--右侧-->
        <div class="right">
            <div class="layui-row">
            <fieldset class="layui-elem-field layui-field-title">
                <legend>房间列表</legend>
            </fieldset>

            <%--搜索--%>
            <form method="post" action="/home">
               <%--隐藏域藏值--%>
                <input type="hidden" name="action" value="query"/>

                <%--添加房间--%>
                <%--<a href="/views/home_add.jsp" class="layui-btn layui-btn-primary" style="float: left"><i class="layui-icon">&#xe654;</i>添加房间</a>--%>

                   <div class="layui-col-lg4" style="float: right" id="container">
                       <%--<div>--%>
                       <%--    <span style="color: red; font-weight: bold" > &nbsp;${error}</span>--%>
                       <%--</div>--%>

                       <div class="layui-input-inline" id="search1">
                           <span class="search-label">房间类型：</span>
                           <input type="text" name="h_type" value="<%=request.getAttribute("h_type")%>"
                                  placeholder="输入房间类型进行查询" class="layui-input key search-input">
                       </div>

                       <div class="layui-input-inline" id="search2">
                           <span class="search-label">房间状态：</span>
                           <select name="state" class="layui-input key search-input">
                               <option value="" style="color: #9a9393">请选择房间状态</option>
                               <option value="空房" <%="空房".equals(request.getAttribute("state"))?"selected":""%>>空房</option>
                               <option value="已入住" <%="已入住".equals(request.getAttribute("state"))?"selected":""%>>已入住</option>
                               <option value="未打扫" <%="未打扫".equals(request.getAttribute("state"))?"selected":""%>>未打扫</option>
                           </select>
                       </div>

                       <div class="layui-input-inline" id="search3">
                           <span class="search-label">房间号：</span>
                           <input type="text" name="num" value="<%=request.getAttribute("num")%>"
                                  placeholder="输入房间号进行查询" class="layui-input key search-input">
                       </div>


                    <div style="float: right">
                        <button type="submit" class="layui-btn " style="width: 100px">查询</button>
                    </div>
                </div>
            </form>

            </div>

            <%--表格--%>
            <table class="layui-table layui-form">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>房间号</th>
                    <th>房间类型</th>
                    <th>价格</th>
                    <th>图片</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>

                <tbody>
                <c:forEach items="${requestScope.homeList}" var="h">
                <tr class="id84">
                    <td>${h.id}</td>
                    <td style="font-weight: bold">${h.num}</td>
                    <td style="width: 18%">${h.h_type}</td>
                    <td>${h.price}</td>
                    <td><img src="${h.img}" height="50"></td>
                    <td style="font-size: 15px">${h.state}</td>
                    <td style="width: 17%">
                    <a href="javascript: if(window.confirm('是否确认删除？'))
                    {window.location.href='/home?action=delete&id=${h.id}'}" style="color: #0d82da">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;删除</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                    <a href="/home?action=goupdate&id=${h.id}" style="color: #0d82da">修改</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                    <a href="/home?action=show&id=${h.id}" style="color: #0d82da">详细信息</a>
                    </td>
                </tr>
                </c:forEach>
                </tbody>
            </table>


        </div>
    </div>
</div>

<script>
    $("td:contains('空房')").css("color","rgb(25,189,59)");
    $("td:contains('已入住')").css("color","rgba(228,53,53,0.93)");
    $("td:contains('未打扫')").css("color","#caaa04");
</script>

<script src="/static/admin/js/config.js"></script>
<script src="/static/admin/js/script.js"></script>
</body>
</html>
